package main;

import draw.StdDraw;

import java.util.Comparator;


public class Point implements Comparable<Point> {
	//public final Comparator<Point> SLOPE_ORDER;        // compare points by slope to this point
	private final int x;
	private final int y;

	public Point(int x, int y) {
		this.x = x;
		this.y = y;
		StdDraw.clear();
        StdDraw.setPenColor(StdDraw.RED);
        StdDraw.setXscale(0, 20);
        StdDraw.setYscale(0, 20);		
	}

	public void draw() {
        StdDraw.point(this.x, this.y);
	}
	   
	public void drawTo(Point that) {
	   // draw the line segment from this point to that point
	}
   
	public String toString() {
		return "test";
	}

	public int compareTo(Point that) {
		if (this.y < that.y)
			return -1;
		else if (this.y > that.y)
			return 1;
		else if (this.y == that.y) {
			if (this.x < that.x)
				return -1;
			else if (this.x > that.x)
				return 1;
			else if (this.x == that.x)
				return 0;
		}
		return 2;
	}
   
	public double slopeTo(Point that) {
		if (this.x == that.x && this.y == that.y)
			return Double.NEGATIVE_INFINITY;
		return (double)(that.y - this.y)/(that.x - this.x);
	}
	
	public static void main(String[] args) {
		Point p = new Point(10, 10);
		p.draw();
	}
}
